package com.fangs.kotlin_banner.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.fangs.kotlin_banner.R
import com.fangs.kotlin_banner.banner.BannerPage

class PointQuickAdapter : BaseQuickAdapter<BannerPage?, BaseViewHolder>(R.layout.rl_item_point) {
    private var selectedPosition = 0
    fun setSelectedPosition(position: Int) {
        selectedPosition = position
    }

    override fun convert(helper: BaseViewHolder, item: BannerPage?) {
        helper.setImageResource(
            R.id.view_point, if (selectedPosition ==
                helper.adapterPosition
            ) R.drawable.bg_solid_000000_w18_h3 else R.drawable.bg_solid_ffffff_w9_h3
        )
    }
}